package java6681.lesson12;


import java.util.Arrays;

/**
 * @Title: Triangle6681
 * @Author Junichiro
 * @Description:TODO
 * @Date: 2020/12/10 0010 下午 1:57
 */

//javac -d . Triangle6681.java
//java java6681.lesson12.Triangle6681
public class Triangle6681 {
    public static void main(String[] args) {
        int n = args.length;
        if (n == 3) {
            int a = Integer.parseInt(args[0]);
            int b = Integer.parseInt(args[1]);
            int c = Integer.parseInt(args[2]);
            System.out.println(Arrays.toString(args));
            if (isTriangle6681(a, b, c)) {
                System.out.println("可以构成三角形");
            } else {
                System.out.println("不能构成三角形");
            }
        } else {
            System.out.println("请输入三个正整数作为三角形的边长");
        }
    }

      /*  Scanner input=new Scanner(System.in);
        try {
            int a = Integer.parseInt(args[0]);
            int b = Integer.parseInt(args[1]);
            int c = Integer.parseInt(args[2]);
            isTriangle6681(a,b,c);
        } catch (IllegalArgumentException e) {
            e.getMessage();
            e.printStackTrace();
        }catch (Exception e) {
            e.printStackTrace();
        }finally {
            input.close();
        }*/


    public static boolean isTriangle6681(int a, int b, int c) {
        if (a > 0 && b > 0 && c > 0) {
            return a + b > c && b + c > a && c + a > b;
        }
        return false;
    }
}
